from django.urls import include, path
from rest_framework import routers

# from apps.ormlab.models import Book
from apps.ormlab.views import BookViewSet, Home, AuthorViewSet, TagsViewSet

defaultRouter = routers.DefaultRouter()
defaultRouter.register(r"author", AuthorViewSet)
defaultRouter.register(r"tags", TagsViewSet)

urlpatterns = [
    path("", Home.as_view()),
    path('', include(defaultRouter.urls)),
    path("book/", BookViewSet.as_view({"get": "list", "post": "create"})),
    path("book/<int:pk>/", BookViewSet.as_view({"get": "retrieve", "delete": "destroy", 'put': 'partial_update'}))

]